<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>组件里的data</title>
</head>
<body>

<div id="app">
<cpn></cpn>
</div>

<template id="cpn">
  <div>
    <h2>我是标题</h2>
    <h3>{{message}}</h3>
  </div>
</template>

<script src="../js/vue.js"></script>
<script>

  //创建组件构造器
  let cpnConstructor = Vue.extend({
    template: '#cpn',
    data(){
      return {
        message: 'Hello,Vue.js!'
      }
    }
  });

  //注册全局组件
  Vue.component('cpn',cpnConstructor);

  let app = new Vue({
    el: '#app',
    data: {
    },
  });

</script>

</body>
</html>